<template>
    <view class="">
        <web-view :src="curl" v-if="deviceId"></web-view>
    </view>
</template>

<script>
import {
	hanleToken
} from '@/utils/utils.js';
import { mapState, mapActions, mapMutations } from 'vuex';
import config from '@/utils/config.js';
export default {
	data() {
		return {
			baseUrl: config.webHeader + '/live/#/pages/liveRoom/index/',
			pagePath:'index',
			token: (hanleToken('get', 'token') || '').replace(' ',','),
			deviceId: '',
			name: '',
			projectName: '',
			serviceName: '',

		};
	},

	computed: {
		...mapState('user', ['userinfo']),
		curl() {
			return this.baseUrl + this.pagePath + `?deviceType=maintenance&token=${this.token}&elevatorId=${this.elevatorId}&userId=${this.userinfo.user_id}&userName=${this.userinfo.nick_name}&deviceId=${this.deviceId}&projectName=${this.projectName}`;
		}
	},
	onHide(res) {
		console.log('onHide........', res);
		uni.navigateBack();
	},
	async onLoad(os) {
		if (os.pagePath) {
			this.pagePath = os.pagePath;
		}
		uni.getStorage({
			key: 'videoCall',
			success: (res) => {
				this.deviceId = res.data.deviceId;
				this.elevatorId = res.data.elevatorId;
				this.projectName = (res.data.projectName || res.data.buildingName) + ' ' + (res.data.elevatorAddress || '');
				this.serviceName = res.data.serviceName;
			},
		});
	},
	methods: {

	}
};
</script>

<style></style>
